import React from "react";
import ReactDOM from 'react-dom'
import {designPage} from "plain-design-composition";
import {createCmsPreview} from "../../components/CmsPreview";
import '../../main.scss'
import {useRemoveData} from "../index/useRemoteData";
import {predefineActionRender} from "../public/predefineAction.render";
import {reactivityApi} from "../../packages/utils/vueReactivityApi";

const Preview = designPage(() => {
    const data = useRemoveData()
    const CmsPreview = createCmsPreview({api: reactivityApi, processActionRender: predefineActionRender})
    return () => (
        !!data.value && <CmsPreview data={data.value}/>
    )
})

ReactDOM.render(<Preview/>, document.querySelector('#app'))
